package gxb.test05;

import java.util.Scanner;

public class Factorials {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int anInt = sc.nextInt();

        int tatol=0;
        //遍历每个factor，并让他逐渐减少1，直至到1
        for (int i = anInt; i >1; i--) {
            tatol+=factor(i);
        }

        System.out.println(tatol);
    }

    /*static int factor(int n){
        //设置一个函数用于统计函数1*2...*n的乘积
        int sum=1;
        if (n==0) return 1;
        for (int i = 1; i <= n; i++) {
            sum*=i;
        }
        return sum;
    }*/
    static int factor(int n){
        int sum=1;
        int i=1;
        if (n==0) return 1;
        while ( i !=n+1){
            sum*=i;
            i++;
        }
        return sum;
    }
}
